<%@ page import="java.io.*,java.util.*,java.net.*,java.sql.*" %>
<%@ include file="conexion.jsp" %>
<!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Ejemplo consulta JSP</title></head>
<body><center>
<%
	Connection canal = null;
	Statement instruccion=null;
	ResultSet tabla= null;
	String conexion = "jdbc:mysql://localhost/simple?user="+usuarioMysql()+"&password="+passwordMysql();
	//Abrir el enlace
	try{
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		canal = DriverManager.getConnection(conexion);
		instruccion = canal.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
	}catch(ClassNotFoundException e){ 
		out.println(e);
	}catch(SQLException e){
		out.println(e);
	}

	try{
		tabla = instruccion.executeQuery("select cedula, nombre from hombre");
		out.println("<table border=1>");
		out.println("<tr><th>Cedula</th><th>Nombre</th></tr>");
		while(tabla.next()){
			out.println("<tr><td>"+tabla.getString(1)+"</td><td>"+tabla.getString(2)+"</td></tr>");
		}
		out.println("</table>");
	}catch(Exception e){ 
		out.println(e);
	}
%>
</center></body>
</html>